/**************************************************************************
* This file is part of Hawkengine.
**
* Hawkengine is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
**
* Hawkengine is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU Lesser General Public License for more details.
**
* You should have received a copy of the GNU Lesser General Public License
* along with Hawkengine.  If not, see <http://www.gnu.org/licenses/>.
**************************************************************************/

#ifndef _SETTINGS_H_
#define _SETTINGS_H_

/**************************************************************************
* Dependencies
**************************************************************************/
#include "engine/common.h"
 
/**************************************************************************
* Preprocessing
**************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif

#define MAX_SETTING_NAME_LENGTH 32
#define MAX_SETTING_STRING_LENGTH 64

/**************************************************************************
* Types
**************************************************************************/
typedef enum
{
  BOOL_DATA,
  FLOAT_DATA,
  INT_DATA,
  STRING_DATA,
} setting_data_type;

typedef struct
{
  char name[MAX_SETTING_NAME_LENGTH];
  setting_data_type data_type;
  union {
    BOOL boolValue;
    float floatValue;
    int intValue;
    char stringValue[MAX_SETTING_STRING_LENGTH];
  } data;
} setting_type;

/**************************************************************************
* Variables
**************************************************************************/
extern const char* OPTIONS_SETTINGS;

/**************************************************************************
* Static Variables
**************************************************************************/

/**************************************************************************
* Function Prototypes
**************************************************************************/
BOOL settings_get(const char* settings_name, const char* setting_name,
                  void* value);
void settings_init(void);
void settings_remove_setting(const char* settings_name, const char* setting_name);
void settings_remove_settings(const char* settings_name);
BOOL settings_save(void);
BOOL settings_session_load(void* session, int session_size);
int settings_session_load_size(void);
BOOL settings_session_save(const void* session, int session_size);
void settings_set(const char* settings_name, const char* setting_name,
                  setting_data_type data_type, const void* value);
void settings_uninit(void);

/**************************************************************************
* Function Implementations
**************************************************************************/


#ifdef __cplusplus
}
#endif

#endif
